import { GetCategory, GetCategoryAll } from "@/api/news";

const state = {
  QiniuUrl: "http://qgox6rjkz.hn-bkt.clouddn.com/"
};
const getters = {
  qiniuUrl: state => state.QiniuUrl
};
const actions = { // 可以有回调
  getInfoCategory(content, data) {
    return new Promise((resolve, reject) => {
      GetCategory({}).then(res => {
        let data = res.data.data.data;
        resolve(data);
      }).catch(error => {
        reject(error);
      });
    });
  },
  getInfoCategoryAll(content, data) {
    return new Promise((resolve, reject) => {
      GetCategoryAll({}).then(res => {
        let data = res.data.data;
        resolve(data);
      }).catch(error => {
        reject(error);
      });
    });
  }
};
export default {
  namespaced: true, // 解决命名空间问题
  state,
  getters,
  actions
};
